#!/bin/bash
#
# Database home : /db
# 

echo "================================================================="
echo "Install db ($SERVER_NAME): begin"

DB_HOME=/db

source $COMMON_FUNC > /dev/null 2>&1
if [ $? -gt 0 ]; then
    echo "Error: This script requires common-func.bash"
    exit 1
fi

isRoot

group_exists dbdat
if [ $? -eq 1 ]; then
    echo "Creating group dbdat"
    groupadd dbdat
else
    echo "Group dbdat already exists, nothing to do"
fi

echo "Creating database home at $DB_HOME"
mkdir -p $DB_HOME
mkdir -p $DB_HOME/etc

echo "Applying permissions to $DB_HOME to group dbdat"
chown -R :dbdat $DB_HOME
chmod -R 770 $DB_HOME

echo "Install db: done"
echo "================================================================="
